package fatworm.query.expression;

import fatworm.query.Plan;
import fatworm.query.Scan;
import fatworm.query.constant.Constant;
import fatworm.storage.table.*;
import fatworm.util.Lib;

public class ConstantExpression implements Expression {
	
	private Constant c;
	
	public ConstantExpression(Constant c) {
		this.c = c;
	}
	
	public boolean isConstant() {
		return true;
	}
	
	public boolean isFieldName() {
		return false;
	}
	
	public boolean isOp() {
		return false;
	}
	
	public boolean isSubquery() {
		return false;
	}
	
	public Constant asConstant() {
		return c;
	}
	
	public String asFieldName() {
		Lib.assertNotReached();
		return null;
	}
	
	public Plan asSubquery() {
		Lib.assertNotReached();
		return null;
	}
	
	public Constant evaluate(Scan s) {
		return c;
	}
	
	public boolean isIn(Schema sch) {
		return false;
	}
	
	public String toString() {
		return c.toString();
	}
	
}